/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.eleric.rememome.db.factory.impl;

import com.eleric.rememome.db.DbRetriever;
import com.eleric.rememome.db.MemoDbAdaptor;
import com.eleric.rememome.db.factory.DbRetrieverFactory;
import com.eleric.rememome.db.impl.DbMemoCategoryRetrieverVer1;
import com.eleric.rememome.memo.MemoCategory;
import com.eleric.rememome.memo.impl.MemoCategoryVer1;

/**
 *
 * @author MWaldman
 */
public class MemoCategoryDbRetrieverFactory implements DbRetrieverFactory<MemoCategory>
{
    public static final String KEY_ROWID = "_id";
    public static final String KEY_SHORT_NAME = "shortName";
    public static final String KEY_LONG_NAME = "longName";
    public static final String[] COLUMNS =
    {
        KEY_ROWID,
        KEY_SHORT_NAME,
        KEY_LONG_NAME
    };
    private String table;
    private String prevTable;

    public MemoCategoryDbRetrieverFactory(MemoDbAdaptor memoDbAdaptor)
    {
        this.table = memoDbAdaptor.getMemoCategoryTableName();
        this.prevTable = memoDbAdaptor.getMemoCategoryTableName()+memoDbAdaptor.getPreviousVersion();
    }

    public DbRetriever<MemoCategory> getCurrentVersionDbRetriever()
    {
        return new DbMemoCategoryRetrieverVer1(table);
    }

    public DbRetriever<MemoCategory> getPreviousVersionDbRetriever()
    {
        // No previous version of this table
        return new DbMemoCategoryRetrieverVer1(prevTable);
    }

    public MemoCategory getInstance()
    {
        return new MemoCategoryVer1();
    }

}
